﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RM.Core;
using RM.Data;
using RM.Services;

namespace RM.Admin.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            IRecordTimeService recordTimeService = EngineContext.Current.Resolve<IRecordTimeService>();
            //RecordDay rday = new RecordDay()
            //{
            //    UserId = "zhangxl2",
            //    Date = DateTime.Now,
            //    Remark = "no remark"
            //};
            //int recordDayId = recordTimeService.InsertRecordDay(rday);
            RecordTime rTime = new RecordTime()
            {
                RecordDayId = 4,
                Level = -1,
                StartTime = DateTime.Now.AddHours(-1),
                EndTime = DateTime.Now,
                Remark = "no remark",
                Title = "no title"
            };
            recordTimeService.InsertRecordTime(rTime);
            RecordDay rd= recordTimeService.GetByDateTime(DateTime.Now);
            return View(rd);
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
